<template>
  <div class="">
    <ul class="list">
      <li v-for="(item, index) in $store.state.list" :key="index">
        <input
          v-model="$store.state.result"
          :value="item"
          type="checkbox"
          @change="check"
        />
        <span>{{ item.title }}</span>
        <button @click="remove(index)">删除</button>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  data() {
    return {};
  },
  mounted() {},
  methods: {
    remove(index) {
      this.$store.commit("remove", index);
    },
    check() {
      this.$store.commit("check");
    },
  },
  components: {},
};
</script>

<style lang="scss">
.list {
  li {
    button {
      display: none;
    }
    &:hover {
      background: #ccc;
      button {
        display: inline-block;
      }
    }
  }
}
</style>
